<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>

<form:form commandName="taskNew" cssClass="form-horizontal" role="form" onsubmit="return false">
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right">任务名称</label>
        <div class="col-sm-8">
            <input type="text" value="${taskNew.taskName}" class="form-control" readonly>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right">任务内容</label>
        <div class="col-sm-8">
            <textarea rows="5" class="form-control" readonly>${taskNew.content}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right">任务附件</label>
        <c:if test="${empty taskNew.file}">
            <div class="col-sm-3">
                <input type="text" value="无任务附件" class="form-control" readonly>
            </div>
        </c:if>
        <c:if test="${!empty taskNew.file}">
            <div class="col-sm-2">
                <input type="button" value="下载" onclick="downDetail('${taskNew.file}')" style="width: 100%; height: 32px;"
                       class="btn-large btn-primary"/>
            </div>
        </c:if>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right">任务时限</label>
        <div class="col-sm-3">
            <input type="text" value="${taskNew.dateTime}" class="form-control" readonly/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right">督查人</label>
        <div class="col-sm-3">
            <input type="text" value="${taskNew.operator}" class="form-control" readonly>
        </div>
        <label class="col-sm-2 control-label no-padding-right">督查人电话</label>
        <div class="col-sm-3">
            <input type="text" value="${taskNew.operatorTel}" class="form-control" readonly>
        </div>
    </div>
    <div class="form-group" style="position: relative;">
        <label class="col-sm-2 control-label no-padding-right">文号</label>
        <div class="col-sm-3">
            <input type="text" value="${taskNew.referenceNumber}" class="form-control" readonly>
        </div>
        <label class="col-sm-2 control-label no-padding-right">事项类型</label>
        <div class="col-sm-3">
            <select name="categoryId" id="categoryId" class="form-control required" onchange="changeCategory(this)" disabled>
                <option value="">点击选择</option>
                <option value="01" <c:if test="${taskNew.categoryId == '01'}">selected="selected"</c:if>>会议纪要</option>
                <option value="02" <c:if test="${taskNew.categoryId == '02'}">selected="selected"</c:if>>省市县为民办实事</option>
                <option value="03" <c:if test="${taskNew.categoryId == '03'}">selected="selected"</c:if>>省市县政府工作报告</option>
                <option value="04" <c:if test="${taskNew.categoryId == '04'}">selected="selected"</c:if>>政协提案办理</option>
                <option value="05" <c:if test="${taskNew.categoryId == '05'}">selected="selected"</c:if>>县长批示件</option>
                <option value="06" <c:if test="${taskNew.categoryId == '06'}">selected="selected"</c:if>>人大建议办理</option>
                <option value="06" <c:if test="${taskNew.categoryId == '07'}">selected="selected"</c:if>>文件办理告知单</option>
                <option value="06" <c:if test="${taskNew.categoryId == '08'}">selected="selected"</c:if>>县委交办事项</option>
                <option value="07" <c:if test="${taskNew.categoryId == '09'}">selected="selected"</c:if>>其他事项</option>
            </select>
        </div>
    </div>
    <%--会议纪要内容DIV--%>
    <div id="hyjyContent">
        <c:if test="${not empty sendList}">
            <c:forEach items="${sendList}" var="send">
                <div class="form-group">
                    <c:if test="${!empty send.remark}">
                        <label class="col-sm-2 control-label no-padding-right">议题内容</label>
                        <div class="col-sm-8">
                            <textarea type="text" class="form-control" readonly>${send.remark}</textarea>
                        </div>
                    </c:if>
                </div>
                <div class="form-group">
                <label class="col-sm-2 control-label no-padding-right">承办单位</label>
                    <div class="col-sm-3">
                        <input type="text" value="${send.departName}" class="form-control" readonly>
                    </div>
                </div>
                <span id="sendId" hidden>${send.sysId}</span>

                <c:forEach items="${workableList}" var="workable">

                    <c:if test="${send.sysId == workable.sendId}">
                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right">${send.departName}经办人</label>
                            <div class="col-sm-3">
                                <input type="text" value="${workable.operator}" class="form-control" readonly>
                            </div>
                            <label class="col-sm-2 control-label no-padding-right">${send.departName}经办人电话</label>
                            <div class="col-sm-3">
                                <input type="text" value="${workable.operatorTel}" class="form-control" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label no-padding-right">经办议题</label>
                            <div class="col-sm-3">
                                <input type="text" value="${workable.remark}" class="form-control" readonly>
                            </div>
                        </div>
                    </c:if>
                </c:forEach>

                <div class="form-group">
                    <div class="col-xs-2 col-xs-offset-2">
                        <button class="btn btn-sm btn-success" data-id="${send.sysId}" style="width:100%;"  >完成情况</button>
                    </div>
                </div>

          <%--      <c:if test="${!empty send.file}">
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">${send.departName}反馈附件</label>
                        <div class="col-sm-2">
                            <input type="button" value="下载" onclick="downDetail('${send.file}')" style="width: 100%; height: 32px;"
                                   class="btn-large btn-primary"/>
                        </div>
                    </div>
                </c:if>
                <c:if test="${!empty send.feedback}">
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">${send.departName}反馈内容</label>
                        <div class="col-sm-8">
                            <textarea rows="2" class="form-control" readonly>${send.feedback}</textarea>
                        </div>
                    </div>
                </c:if>--%>
            </c:forEach>
        </c:if>
    </div>
    <c:if test="${!empty taskNew.comment}">
    <div class="form-group">
        <label class="col-sm-2 control-label no-padding-right">任务评价</label>
        <div class="col-sm-8">
            <textarea rows="5" class="form-control" readonly>${taskNew.comment}</textarea>
        </div>
    </div>
    </c:if>
</form:form>
<script src="<s:url value="/assets/js/chosen.jquery.js"></s:url>"></script>
<script src="<s:url value="/assets/js/ajaxfileupload.js"></s:url>"></script>
<script src="<s:url value="/assets/js/modal/modal.js"></s:url>"></script>

<script type="text/javascript">
    //下载按钮
    function downDetail(id) {
        var url = "/filesUpload/download/" + id;
        window.open(url);
    }
    $(".form-group .btn-success").click(function () {
        var sendId=$(this).data("id");
        loadDialog({
            dialogTitle: '完成情况列表',
            dialogUrl: "/taskSend/backList/" + sendId,
            dialogFoot: '<button type="button" class="btn btn-default " onclick="openTask()">关闭</button>'
        });
    });
    function openTask() {
        showEditDialog({
            tableId: "#gridTable",
            dialogTitle: "任务详情",
            dialogUrl: getUrl("detail"),
            dialogFoot: '<button type="button" class="btn btn-success" onclick="modify()">修改</button>'+
            '<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>',
        });
    }
</script>
